/**
 * 入参
 * 存款类型（枚举数据源）typeList
 * 存款总行（枚举数据源） headBankList
 * 存款详情 depositInfo
 * state：10交易录入 1-指令下达（初始或通过持仓回填）    2-新增簿记（初始或通过持仓回填）    3-编辑簿记    4-簿记交收    5-簿记详情    6-指令详情
 * 出参
 * 响应组合变更事件，抛出组合ID
 * 通过onRef调用getInfo方法，获取当前存入指令的全部数据
 */
import React, { PureComponent } from 'react';
import { DATA_ENTRY, FormGroup } from '../../../comps';
import { Form } from '@ant-design/compatible';
import '@ant-design/compatible/assets/index.css';
import { message } from 'antd';
import investmentTypeData from '../../../utils/enumeratedValues/investmentType';
import config from './config';
import { connect } from 'dva';
import 'moment/locale/zh-cn';
import moment from 'moment';
import './index.less';
import { calculateFee } from '../../../utils/commonFunc';

@connect(({ depositOrderM, userM: user, isAccountConfiguredM, globalM, loading }) => ({
  depositOrderM,
  user,
  isAccountConfiguredM,
  globalM,
  loading,
}))
@Form.create()
export default class SaveOrder extends PureComponent {
  static defaultProps = {
    onRef: () => {},
  };
  state = {
    depositInfo: undefined, //存款详情
    branchBankList: [], //存款分行
    headBankList: [], //存款总行 为了进行模糊查询
    type: undefined, //当前指令的类型 1-指令下达（初始或通过持仓回填）    2-新增簿记（初始或通过持仓回填）    3-编辑簿记    4-簿记交收    5-簿记详情    6-指令详情
    headBankNameSearch: undefined, //当前的存款总行输入值
    bankDepositRate: undefined, //存款利率
    accountList: [], //存款账户列表
    isCanOrder: true, //是否可以下达 默认可以下达
    feeData: {
      //费用自动计算条件
      productId: undefined,
      portfolioid: undefined,
      sectype: 'ck',
      orderside: 'F',
      price: undefined,
    },
  };
  componentDidMount() {
    this.props.onRef(this);
    this.setState(
      {
        type: this.props.state,
      },
      () => {
        this.originData = _.cloneDeep(this.state);
      },
    );
  }
  UNSAFE_componentWillReceiveProps(nextProps) {
    //存款详情默认是undefined，当存款详情变更时，更新初始化值；
    if (nextProps.depositInfo && nextProps.depositInfo !== this.state.depositInfo) {
      this.setState(
        {
          depositInfo: nextProps.depositInfo,
        },
        () => {
          this.setValues();
        },
      );
    }
  }

  //费用自动计算
  changeFee = (type, data) => {
    const {
      form: { setFieldsValue },
    } = this.formContent.props;
    if (this.props.type == 3 || this.props.type == 5) return; //详情不计算
    setTimeout(() => {
      if (data == undefined) {
        setFieldsValue({ fee: undefined });
        if (type == 'productId') {
          this.setState({ feeData: { ...this.state.feeData, productId: undefined, portfolioid: undefined } });
        } else {
          this.setState({ feeData: { ...this.state.feeData, [type]: undefined } });
        }
      } else {
        this.setState({ feeData: { ...this.state.feeData, [type]: data } }, () => {
          let fee = calculateFee(this.state.feeData, this.state.type == 10 ? true : false);
          fee.then((r) => {
            setFieldsValue({ fee: r });
          });
        });
      }
    }, 100);
  };

  //reset 重置
  reset = () => {
    this.setState({
      ...this.originData,
      isAdvanceInterest: undefined,
    });
    this.formContent.props.form.resetFields();
  };
  //回填详情信息
  setValues = () => {
    const { depositInfo, type } = this.state;
    const {
      globalM: {
        dataDictionary: { C_CUSTODIAN },
      },
    } = this.props;
    if (type > 2 && type != 10) {
      this.formContent.props.form.setFieldsValue({
        remark: depositInfo.remark,
      });
    }
    C_CUSTODIAN.map((item) => {
      if (item.code == depositInfo.bankTrusteeshipQua) {
        depositInfo.bankTrusteeshipQua = item.value;
      }
    });
    const bankHead = depositInfo.bankHeadOfficeId ? depositInfo.bankHeadOfficeId : depositInfo.bankHeadOfficeName;
    const bank = depositInfo.bankBranchName;
    if (type != 10) {
      //交易录入不参与
      //获取存款账户的下拉列表
      this.getAccountInfo(bank);
      //获取分行的下拉列表
      this.getBranchBankList(bankHead);
      //获取总行的下拉列表
      this.getHeadBankList(bankHead);
    }
    this.formContent.props.form.setFieldsValue({
      depositType: depositInfo.depositType,
      bankHeadOfficeName: type != 10 ? bankHead : depositInfo.bankHeadOfficeName,
      bankBranchName: depositInfo.bankBranchName,
      bankDepositBalance: depositInfo.bankDepositBalance,
      bankDepositRate: depositInfo.bankDepositRate,
      bankStartDate: moment(depositInfo.bankStartDate),
      bankEndDate: depositInfo.depositType !== '00' ? moment(depositInfo.bankEndDate) : undefined,
      advanceInterestrate: depositInfo.advanceInterestrate,
      isAdvanceInterest: depositInfo.isAdvanceInterest !== null ? depositInfo.isAdvanceInterest : '1',
      earlyDrawdownCom: depositInfo.earlyDrawdownCom,
      earlyDrawdown: depositInfo.earlyDrawdown !== null ? (depositInfo.earlyDrawdown == 'Y' ? '0' : '1') : undefined,
      bankTrusteeshipQua: depositInfo.bankTrusteeshipQua,
      account: depositInfo.account,
      investmentType: depositInfo.investmentType,
      fee: depositInfo.fee,
      jixiBase: depositInfo.jixiBase,
      secucodeName: depositInfo.secucodeName,
      secucodeType: depositInfo.secucodeType,
    });
    this.changeFee('price', depositInfo.bankDepositBalance);
    if (depositInfo.userId && type > 2) {
      if (type == 10) return;
      this.formContent.props.form.setFieldsValue({
        orderPerson: depositInfo.userId + '-' + depositInfo.userName,
      });
    }
  };
  //组合改变
  groupOnChange = (value) => {
    //抛出组合id
    if (value) this.props.getFundCode(value.key);
    if (value && this.props.state == 1) {
      //新增指令时 需要判断该组合是否进行了指令配置
      this.props.dispatch({
        type: 'isAccountConfiguredM/queryIsAccountConfigured',
        payload: {
          portId: value.key,
        },
        callback: (data) => {
          if (data.result) {
            this.setState({
              isCanOrder: true,
            });
          } else {
            this.setState({
              isCanOrder: false,
            });
            message.warning(data.msg);
          }
        },
      });
    } else if (!value && this.props.state == 1) {
      this.setState({
        isCanOrder: true,
      });
    }
  };
  //产品改变
  productOnChange = (value) => {
    if (value) {
      //抛出产品id
      if (value) this.props.getProductCode(value.key);
      this.formContent.props.form.setFieldsValue({
        bankHeadOfficeName: undefined, //重置分行总行 账户数据
        bankBranchName: undefined,
        account: undefined,
      });
      this.setState({
        headBankList: [], //存款总行重置为空数据
        branchBankList: [], //分行为空数组
        accountList: [], //存款账户重置为空数组
      });
      if (this.props.form.getFieldsValue().depositType == '00') {
        this.formContent.props.form.setFieldsValue({
          bankDepositRate: undefined,
          //活期情况下 存款利率
        });
      }
      this.getHeadBankList(undefined, value.key); //获取定期存款的总行下拉数据
    }
  };
  //设置托管资格
  setBankTrusteeshipQua = (e) => {
    const {
      form: { setFieldsValue },
    } = this.props;
    const { headBankList } = this.state;
    if (!e)
      this.formContent.props.form.setFieldsValue({
        //     * 0-无资格；1-有托管资格；2-只有代销资格
        bankTrusteeshipQua: undefined,
      });
    headBankList.map((item) => {
      if (e == item.bankNo) {
        this.formContent.props.form.setFieldsValue({
          //     * 0-无资格；1-有托管资格；2-只有代销资格
          bankTrusteeshipQua: item.custodianName,
        });
      }
    });
  };
  //模糊查询总行列表
  getHeadBankList = (e, combCode) => {
    const { dispatch, depositInfo } = this.props;
    if (this.state.type == 10) return; //交易录入 改为输入框
    this.setState({
      headBankNameSearch: e === undefined ? '' : e,
    });
    const params = {};
    params.value = e === undefined ? '' : e; //入参有值传入后端
    //详情的时候 也要判断是否有产品id 和存款类型
    if (((this.formContent.props.form.getFieldsValue().combCode || combCode) && this.formContent.props.form.getFieldsValue().depositType) || depositInfo) {
      this.timer ? clearTimeout(this.timer) : '';
      this.timer = setTimeout(() => {
        dispatch({
          type: 'depositOrderM/getHeadBankList',
          payload: {
            productId: this.formContent.props.form.getFieldsValue().combCode || depositInfo.combCode,
            accountType: this.formContent.props.form.getFieldsValue().depositType || depositInfo.depositType,
            ...params,
          },
          callback: (type, val, data) => {
            if (type == 'success') {
              if (val == this.state.headBankNameSearch) {
                //防止上一次延迟返回 赋值到本次查询中
                this.setState({
                  headBankList: data,
                });

                this.props.vcBankName(data);
              }
            } else {
              if (val == this.state.headBankNameSearch) {
                this.setState({
                  headBankList: [],
                });
              }
            }
          },
        });
      }, 500);
    }
  };
  //总行切换查询分行列表
  getBranchBankList = (e, type) => {
    this.formContent.props.form.setFieldsValue({
      bankBranchName: undefined,
      account: undefined, //重置存款账户
    });
    if (this.formContent.props.form.getFieldsValue().depositType == '00') {
      this.formContent.props.form.setFieldsValue({
        bankDepositRate: undefined,
        //活期情况下 存款利率
      });
    }
    this.setState({
      //重置分行 账户为空数组
      accountList: [],
      branchBankList: [],
    });
    //总行变更，判断是否有托管资格
    this.setBankTrusteeshipQua(e);
    if (!e) {
      this.getHeadBankList(undefined);
      return;
    }
    this.props.dispatch({
      type: 'depositOrderM/getBranchBankList',
      payload: {
        bankNo: e,
        accountType: this.formContent.props.form.getFieldsValue().depositType || this.props.depositInfo.depositType,
        productId: this.formContent.props.form.getFieldsValue().combCode || depositInfo.combCode,
      },
      callback: (type, data) => {
        if (type == 'success') {
          this.setState({
            branchBankList: data,
          });
        } else {
          this.setState({
            branchBankList: [],
          });
        }
      },
    });
  };
  //是否提前支取切换
  handleChange = (e) => {
    this.setState({
      isAdvanceInterest: e,
    });
    if (e == 1) {
      this.formContent.props.form.setFieldsValue({
        advanceInterestrate: undefined,
        earlyDrawdown: undefined,
        earlyDrawdownCom: undefined,
      });
    }
  };

  //存款类型 变更
  handleChangeDepositType = (e) => {
    //调用存款总行列表
    this.formContent.props.form.setFieldsValue({
      depositType: e,
      bankHeadOfficeName: undefined, //重置分行总行数据
      bankBranchName: undefined,
      bankDepositRate: undefined, //利率 设置为空
      account: undefined,
      bankTrusteeshipQua: undefined, //托管资格清空
    });
    this.setState({
      //重置分行总行 账户为空数组
      branchBankList: [],
      accountList: [],
      headBankList: [],
    });

    if (e == '00') {
      this.formContent.props.form.setFieldsValue({
        bankEndDate: undefined,
      });
      if (this.state.type != 10) {
        //非交易录入的情况下 活期时 提前支取为是 且不可编辑
        this.formContent.props.form.setFieldsValue({
          isAdvanceInterest: '0',
        });
      }
    } else {
      if (this.state.type != 10) {
        //非交易录入的情况下 其他类型 提前支取为否 且可编辑
        this.formContent.props.form.setFieldsValue({
          isAdvanceInterest: '1',
        });
      }
    }
    this.getHeadBankList(undefined);
  };
  //存款分行变更
  bankBranchChange = (e) => {
    //重置存款账户、存款利率
    this.formContent.props.form.setFieldsValue({
      bankBranchName: e,
      account: undefined,
    });
    if (this.formContent.props.form.getFieldsValue().depositType == '00') {
      this.formContent.props.form.setFieldsValue({
        bankDepositRate: undefined,
        //活期情况下 存款利率
      });
    }
    this.setState({
      accountList: [],
    });
    if (e) {
      //分行有数据则查询，没有则清空
      this.getAccountInfo(e);
    }
  };
  //存款账户变更 请求存款利率
  accountChange = (e) => {
    if (e && this.formContent.props.form.getFieldsValue().depositType == '00') {
      this.props.dispatch({
        type: 'depositOrderM/getRate',
        payload: {
          productId: this.formContent.props.form.getFieldsValue().combCode,
          accountType: this.formContent.props.form.getFieldsValue().depositType,
          bankNo: this.formContent.props.form.getFieldsValue().bankHeadOfficeName,
          branchBankName: this.formContent.props.form.getFieldsValue().bankBranchName,
          account: e,
        },
        callback: (type, data) => {
          if (type == 'success') {
            this.formContent.props.form.setFieldsValue({
              bankDepositRate: parseFloat(data * 100).toFixed(2) * 1,
            });
          }
        },
      });
    }
  };
  //根据分行查询存款账户
  getAccountInfo = (e) => {
    const { depositInfo } = this.props;
    this.props.dispatch({
      type: 'depositOrderM/getAccountInfo',
      payload: {
        branchBankName: e,
        bankNo: this.formContent.props.form.getFieldsValue().bankHeadOfficeName || depositInfo.bankHeadOfficeName,
        accountType: this.formContent.props.form.getFieldsValue().depositType || depositInfo.depositType,
        productId: this.formContent.props.form.getFieldsValue().combCode,
      },
      callback: (type, data) => {
        if (type == 'success') {
          this.setState({
            accountList: data,
          });
        } else {
          this.setState({
            accountList: [],
          });
        }
      },
    });
  };
  formRender1 = () => {
    const {
      typeList,
      user: { currentUser },
      form: { getFieldDecorator },
    } = this.props;
    const { type, branchBankList, depositInfo, headBankList, accountList } = this.state;
    const {
      globalM: {
        dataDictionary: { JXJC: JX = [], CKLX = [], BDLX = [] },
      },
    } = this.props;
    let arr = JX.map((item) => {
      return { value: item.code, title: item.value };
    });
    let JXJC = arr.filter((item) => item.value !== '3');
    let disabled;
    var propsRef = this.formContent ? this.formContent.props : this.props;
    let depositType = propsRef.form.getFieldsValue().depositType;
    let combCode = propsRef.form.getFieldsValue().combCode;
    let bankBranchName = propsRef.form.getFieldsValue().bankBranchName;
    let bankHeadOfficeName = propsRef.form.getFieldsValue().bankHeadOfficeName;
    let isAdvanceInterest = propsRef.form.getFieldsValue().isAdvanceInterest;
    if (type == 3 || type == 4 || type == 5 || type == 6) {
      disabled = true;
    }
    if (type == 1 || type == 2 || type == 10 || type == 11) {
      disabled = false;
    }
    let initData = depositInfo && depositInfo.combCode && type > 2 ? [depositInfo.combCode, depositInfo.fundCode] : undefined;
    let type10 = [
      {
        type: DATA_ENTRY.SERIESPRODUCTGROUP,
        title: '系列产品',
        dataIndex: 'combCode',
        initialValue: this.props.listId,
        onChange: (e) => this.props.getFundCode(e ? e.value : undefined),
        disabled: true,
        rules: [{ required: true, message: '请选择系列产品!' }],
        span: 12,
        controlLabelSpan: 8,
      },
      {
        title: '存款类型',
        dataIndex: 'depositType',
        type: DATA_ENTRY.SELECT,
        dataSource: CKLX.map((item) => {
          return { value: item.code, title: item.value };
        }).filter((item) => item.code != '02'), //交易录入不需要通知类型
        isMultiple: false,
        optionTitle: true,
        disabled: disabled,
        initialValue: '01',
        onChange: this.handleChangeDepositType,
        rules: [{ required: true, message: '请选择存款类型!' }],
        span: 6,
        controlLabelSpan: 8,
      },
      {
        type: DATA_ENTRY.SELECT,
        title: '标的类别', // 显示名称
        dataIndex: 'secucodeType', // Form识别的Item ID
        dataSource: BDLX.map((item) => {
          return { value: item.code, title: item.value };
        }),
        isMultiple: false,
        disabled: depositType == '06' ? disabled : true,
        rules: [{ required: depositType == '06' ? true : false, message: '请选择标的类别!' }],
        span: 6,
        controlLabelSpan: 8,
      },
      {
        type: DATA_ENTRY.INPUT,
        title: '标的名称', // 显示名称
        dataIndex: 'secucodeName', // Form识别的Item ID
        disabled: depositType == '06' ? disabled : true,
        placeholder: '证券名称_证券代码',
        rules: [{ required: depositType == '06' ? true : false, message: '请输入标的名称!' }],
        span: 6,
        controlLabelSpan: 8,
      },
      {
        title: '存款总行',
        dataIndex: 'bankHeadOfficeName',
        type: DATA_ENTRY.INPUT,
        disabled: disabled,
        rules: [{ required: true, message: '请输入存款总行!' }],
        placeholder: '请输入',
        span: 6,
        controlLabelSpan: 8,
      },
      {
        title: '存款分行', // 显示名称
        dataIndex: 'bankBranchName', // Form识别的Item ID
        disabled: disabled,
        type: DATA_ENTRY.INPUT,
        rules: [{ required: true, message: '请输入存款分行!' }],
        span: 6,
        controlLabelSpan: 8,
      },
      {
        title: '存款账户',
        type: DATA_ENTRY.INPUT,
        dataIndex: 'account', // Form识别的Item ID
        disabled: disabled,
        rules: [{ required: true, message: '请输入存款账户!' }],
        span: 6,
        controlLabelSpan: 8,
      },
      {
        title: '托管资格',
        type: DATA_ENTRY.INPUT, // 显示名称
        dataIndex: 'bankTrusteeshipQua', // Form识别的Item ID
        disabled: true,
        span: 6,
        controlLabelSpan: 8,
      },
    ];
    let typeOther = [
      {
        type: DATA_ENTRY.PRODUCTGROUPSEP,
        disabled: disabled,
        title: ['产品', '组合'],
        initialValue: initData,
        authority: 'write',
        multipleGroup: false,
        dataIndex: ['combCode', 'fundCode'],
        rules: [[{ required: true, message: '请选择产品' }], [{ required: true, message: '请选择组合' }]],
        groupOnChange: (e) => {
          this.groupOnChange(e);
          this.changeFee('portfolioid', e?.key);
          this.props.portfolioCode(e ? e.info.portfolioCode : undefined); //向外抛出组合code
        },
        productOnChange: (e) => {
          this.productOnChange(e);
          this.changeFee('productId', e?.key);
          this.props.productCode(e ? e.info.portfolioCode : undefined); //向外抛出产品code
        },
        allowClear: false,
        exist: 1,
        span: 12,
        controlLabelSpan: 8,
        tradeModel: type == 1 || type == 2 ? ['BOOKKEEPING_MODE', 'COMMAND_MODE'] : undefined, //不包含估值解析和估值对接的产品
      },
      {
        type: DATA_ENTRY.SELECT,
        title: '投资类型',
        dataIndex: 'investmentType',
        initialValue: 'AC',
        disabled: disabled,
        dataSource: investmentTypeData,
        allowClear: true,
        rules: [{ required: false, message: '请选择' }],
        span: 6,
        controlLabelSpan: 8,
      },
      {
        type: DATA_ENTRY.SELECT,
        title: '存款类型', // 显示名称
        dataIndex: 'depositType', // Form识别的Item ID
        dataSource: CKLX.map((item) => {
          return { value: item.code, title: item.value };
        }),
        isMultiple: false,
        optionTitle: true,
        disabled: disabled,
        initialValue: '01',
        onChange: this.handleChangeDepositType,
        rules: [{ required: true, message: '请选择存款类型!' }],
        span: 6,
        controlLabelSpan: 8,
      },
      {
        type: DATA_ENTRY.SELECT,
        title: '标的类别', // 显示名称
        dataIndex: 'secucodeType', // Form识别的Item ID
        dataSource: BDLX.map((item) => {
          return { value: item.code, title: item.value };
        }),
        isMultiple: false,
        disabled: depositType == '06' ? disabled : true,
        rules: [{ required: depositType == '06' ? true : false, message: '请选择标的类别!' }],
        span: 6,
        controlLabelSpan: 8,
      },
      {
        type: DATA_ENTRY.INPUT,
        title: '标的名称', // 显示名称
        dataIndex: 'secucodeName', // Form识别的Item ID
        disabled: depositType == '06' ? disabled : true,
        placeholder: '证券名称_证券代码',
        rules: [{ required: depositType == '06' ? true : false, message: '请输入标的名称!' }],
        span: 6,
        controlLabelSpan: 8,
      },
      {
        title: '存款总行', // 显示名称
        dataIndex: 'bankHeadOfficeName', // Form识别的Item ID
        type: DATA_ENTRY.SELECT,
        dataSource: headBankList.map((item) => {
          return { value: item.bankNo, title: item.bankName };
        }),
        isMultiple: false,
        optionTitle: true,
        onChange: (e) => this.getBranchBankList(e),
        disabled: type < 3 ? (combCode && depositType ? false : true) : disabled,
        showSearch: true,
        filterOption: false,
        onSearch: this.getHeadBankList,
        rules: [{ required: true, message: '请选择存款总行!' }],
        placeholder: '请输入',
        allowClear: true,
        span: 6,
        controlLabelSpan: 8,
      },
      {
        title: '存款分行', // 显示名称
        type: DATA_ENTRY.SELECT,
        dataIndex: 'bankBranchName', // Form识别的Item ID
        dataSource:
          branchBankList &&
          branchBankList.map((item) => {
            return { value: item.branchBankName, title: item.branchBankName };
          }),
        isMultiple: false,
        optionTitle: true,
        showSearch: true,
        onChange: this.bankBranchChange,
        filterOption: (input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
        disabled: type < 3 ? (bankHeadOfficeName ? false : true) : disabled,
        rules: [{ required: true, message: '请选择存款分行!' }],
        span: 6,
        controlLabelSpan: 8,
      },
      {
        title: '存款账户',
        type: DATA_ENTRY.SELECT, // 显示名称
        dataIndex: 'account', // Form识别的Item ID
        dataSource:
          accountList &&
          accountList.map((item) => {
            return { value: item.value, title: item.value + '-' + item.title };
          }),
        isMultiple: false,
        optionTitle: true,
        showSearch: true,
        onChange: this.accountChange,
        filterOption: (input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
        disabled: type < 3 ? (bankBranchName ? false : true) : disabled,
        rules: [{ required: true, message: '请选择存款账户!' }],
        span: 6,
        controlLabelSpan: 8,
      },
      {
        title: '托管资格', // 显示名称
        type: DATA_ENTRY.INPUT,
        dataIndex: 'bankTrusteeshipQua', // Form识别的Item ID
        disabled: true,
        span: 6,
        controlLabelSpan: 8,
      },
    ];

    let commonData = [
      {
        type: DATA_ENTRY.SINGLEDATE,
        title: '起息日', // 显示名称
        dataIndex: 'bankStartDate', // Form识别的Item ID
        disabled: true,
        initialValue: moment(),
        rules: [{ required: true, message: '请选择起息日!' }],
        span: 6,
        controlLabelSpan: 8,
      },
      {
        type: DATA_ENTRY.SINGLEDATE,
        title: '到期日', // 显示名称
        dataIndex: 'bankEndDate', // Form识别的Item ID
        disableBegin: moment(),
        disableEnd: moment('2999-12-31'),
        disabled: type < 4 || type == 10 || type == 11 ? (depositType == '00' ? true : false) : true,
        rules: [{ required: depositType == '00' ? false : true, message: '请选择到期日!' }],
        span: 6,
        controlLabelSpan: 8,
      },
      {
        type: DATA_ENTRY.INPUTNUMBER,
        dataIndex: 'bankDepositRate',
        title: '存款利率',
        unit: '%',
        min: 0,
        splitStyle: false,
        rules: [{ required: true, message: '请输入存款利率!' }],
        precision: 2,
        disabled: type < 4 ? (depositType == '00' ? true : false) : disabled,
        span: 6,
        controlLabelSpan: 8,
      },
      {
        type: DATA_ENTRY.INPUTNUMBER,
        dataIndex: 'bankDepositBalance',
        title: '存款金额',
        unit: '元',
        min: 0.01,
        splitStyle: true,
        rules: [{ required: true, message: '请输入存款金额!' }],
        precision: 2,
        disabled: type == 3 ? false : disabled,
        span: 6,
        controlLabelSpan: 8,
        onBlur: (e) => this.changeFee('price', e.target?.value ? Number(e.target?.value) : undefined),
      },
      {
        type: DATA_ENTRY.SELECT,
        title: '提前支取', // 显示名称
        dataIndex: 'isAdvanceInterest', // Form识别的Item ID
        dataSource: config.booleanList,
        initialValue: type != 10 ? '1' : '0', //交易录入时置灰显示是
        isMultiple: false,
        optionTitle: true,
        showSearch: false,
        onChange: this.handleChange,
        disabled: type == 3 ? (depositType == '00' ? true : false) : type != 10 ? (depositType == '00' ? true : disabled) : true, //交易录入时置灰显示是 活期是置灰显示是
        rules: [{ required: true, message: '请选择提前支取!' }],
        span: 6,
        controlLabelSpan: 8,
      },
      {
        type: DATA_ENTRY.SELECT,
        title: '计息基础', // 显示名称
        dataIndex: 'jixiBase', // Form识别的Item ID
        dataSource: JXJC,
        isMultiple: false,
        disabled: disabled,
        rules: [{ required: true, message: '请选择计息基础!' }],
        span: 6,
        controlLabelSpan: 8,
        initialValue: '1',
      },
      {
        type: DATA_ENTRY.INPUTNUMBER,
        dataIndex: 'advanceInterestrate',
        title: '提前支取利率',
        unit: '%',
        min: 0,
        splitStyle: false,
        precision: 2,
        disabled: type > 3 && type != 10 ? disabled : isAdvanceInterest == 1 ? true : false,
        span: 6,
        controlLabelSpan: 8,
      },
      {
        type: DATA_ENTRY.SELECT,
        title: '提前支取损失', // 显示名称
        dataIndex: 'earlyDrawdown', // Form识别的Item ID
        dataSource: config.booleanList,
        isMultiple: false,
        optionTitle: true,
        showSearch: false,
        disabled: type > 3 && type != 10 ? disabled : isAdvanceInterest == 1 ? true : false,
        span: 6,
        controlLabelSpan: 8,
      },
      {
        type: DATA_ENTRY.INPUT,
        title: '提前支取条件', // 显示名称
        dataIndex: 'earlyDrawdownCom', // Form识别的Item ID
        disabled: type > 3 && type != 10 ? disabled : isAdvanceInterest == 1 ? true : false,
        span: 6,
        controlLabelSpan: 8,
      },
      {
        type: DATA_ENTRY.INPUT,
        title: '下达人', // 显示名称
        dataIndex: 'orderPerson', // Form识别的Item ID
        initialValue: currentUser.userId + '-' + currentUser.name,
        disabled: true,
        rules: [{ required: true }],
        span: 6,
        controlLabelSpan: 8,
      },
      {
        title: '费用',
        dataIndex: 'fee',
        placeholder: '请输入',
        type: DATA_ENTRY.INPUTNUMBER,
        min: 0,
        precision: 2,
        splitStyle: true,
        disabled: type == 3 ? false : disabled,
        unit: '元',
        span: 6,
        controlLabelSpan: 8,
        hide: type == 10 ? false : true,
      },
      {
        dataIndex: 'remark',
        title: '备注',
        type: DATA_ENTRY.INPUT,
        disabled: type > 3 ? disabled : false,
        showTextArea: true,
        autosize: { minRows: 2, maxRows: 2 },
        span: 24,
        controlLabelSpan: 2,
      },
    ];
    let dataSource = [];
    if (type != 10) {
      dataSource = typeOther.concat(commonData);
    } else {
      dataSource = type10.concat(commonData);
    }
    return <FormGroup onRef={(ref) => (this.formContent = ref)} rowNumber={4} autoLayout={false} dataSource={dataSource} style={{ background: '#FAFBFC' }} />;
  };

  render() {
    return <div>{this.formRender1()}</div>;
  }
}
